﻿//-----------------------------------------------------------------------
// <copyright file="ProcessEntity.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Model
{
    using System;

    using CodePlex.Diagnostics.Contracts;

    /// <summary>
    /// Represents an Process, which is a reusable, versionable, and self-describing building block of a common language runtime application.
    /// </summary>
    public sealed partial class ProcessEntity
    {
        #region public ProcessEntity()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProcessEntity"/> class.
        /// </summary>
        public ProcessEntity()
        {
        }

        #endregion

        #region public ProcessEntity(ProcessDataContract Process)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:ProcessEntity"/> class.
        /// </summary>
        /// <param name="contract">An instance of the <see cref="T:ProcessDataContract"/> class to be used to construct an instance of the <see cref="T:ProcessEntity"/> class.</param>
        public ProcessEntity(ProcessDataContract contract)
        {
            this.BasePriority = contract.BasePriority;

            this.ExitCode = contract.ExitCode;

            this.ExitTime = contract.ExitTime;

            this.HandleCount = contract.HandleCount;

            this.HasExited = contract.HasExited;

            this.Id = contract.Id;

            this.MachineName = contract.MachineName;

            this.MainModule = contract.MainModule;

            this.MainWindowTitle = contract.MainWindowTitle;

            this.MaxWorkingSet = contract.MaxWorkingSet.ToInt64();

            this.MinWorkingSet = contract.MinWorkingSet.ToInt64();

            this.NonpagedSystemMemorySize64 = contract.NonpagedSystemMemorySize64;

            this.PagedMemorySize64 = contract.PagedMemorySize64;

            this.PagedSystemMemorySize64 = contract.PagedSystemMemorySize64;

            this.PeakPagedMemorySize64 = contract.PeakPagedMemorySize64;

            this.PeakVirtualMemorySize64 = contract.PeakVirtualMemorySize64;

            this.PeakWorkingSet64 = contract.PeakWorkingSet64;

            this.PriorityBoostEnabled = contract.PriorityBoostEnabled;

            this.PriorityClass = contract.PriorityClass;

            this.PrivateMemorySize64 = contract.PrivateMemorySize64;

            this.PrivilegedProcessorTime = contract.PrivilegedProcessorTime;

            this.ProcessName = contract.ProcessName;

            this.ProcessorAffinity = contract.ProcessorAffinity.ToInt64();

            this.Responding = contract.Responding;

            this.SessionId = contract.SessionId;

            this.StartTime = contract.StartTime;

            this.Threads = contract.Threads;

            this.TotalProcessorTime = contract.TotalProcessorTime;

            this.UserProcessorTime = contract.UserProcessorTime;

            this.VirtualMemorySize64 = contract.VirtualMemorySize64;

            this.WorkingSet64 = contract.WorkingSet64;
        }

        #endregion
    }
}
